package com.lei.sandbox.security;

import java.security.Permission;


/**
 * @author lei
 */
public class MySecurityManager extends SecurityManager{

    //限制读权限
    @Override
    public void checkRead(String file) {
        if(file.contains("hutool")){
            return ;
        }
        throw new SecurityException("checkRead 权限异常：" + file);
    }

    //限制写文件权限
    @Override
    public void checkWrite(String file) {
        throw new SecurityException("checkWrite 权限异常：" + file);
    }

    //限制删除文件
    @Override
    public void checkDelete(String file) {
        throw new SecurityException("checkDelete 权限异常：" + file);
    }

    //限制执行文件权限
    @Override
    public void checkExec(String cmd) {
        throw new SecurityException("checkExec 权限异常：" + cmd);
    }

    //限制网络链接
    @Override
    public void checkConnect(String host, int port) {
        throw new SecurityException("checkConnect 权限异常：" + host + ":" + port);
    }

}
